{extend name="common/adminBase" /}
{block name="body"}
<style>
    .layui-input-inline{
        width: 400px !important;
    }
</style>
    <body >
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form">
                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>审核范围
                        </label>
                        <div class="layui-input-inline">
                            <select name="type" lay-verify="required">
                                <option value="">--请选择--</option>
                                <option value="普通高校、高职院校" {if $info.type=='普通高校、高职院校'}selected=''{/if}>普通高校、高职院校</option>
                                <option value='其他中小学/中职/特教学校' {if $info.type=='其他中小学/中职/特教学校'}selected=''{/if}>其他中小学/中职/特教学校</option>
                                <option value='直属校' {if $info.type=='市教委直属校'}selected=''{/if}>直属校</option>
                            </select>
                        </div>

                    </div>
                  <div class="layui-form-item">
                      <label for="username" class="layui-form-label">
                          <span class="x-red">*</span>设置名额
                      </label>
                      <div class="layui-input-inline">
                          <input type="text"  name="num" value="{$info.num}" required="" lay-verify="required"
                          autocomplete="off" class="layui-input">
                      </div>
                  </div>

                    <input type="hidden" name="id" value="{$info.id}" />
                  <div class="layui-form-item">
                      <label for="L_repass" class="layui-form-label">
                      </label>
                      <button  class="layui-btn" lay-filter="add" lay-submit="">
                          更新
                      </button>
                  </div>
              </form>
            </div>
        </div>
        <script>

            layui.use(['form', 'layer','laydate','upload'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                layer = layui.layer;
                var laydate = layui.laydate;
                var upload = layui.upload;
                laydate.render({
                    elem: '#date',
                    trigger: 'click',
                    type: 'datetime'
                 });
          
              laydate.render({
                elem: '#year',
                trigger: 'click',
                type:'year'
              });
                form.on('select(lv)',function(data){
                    // console.log(data.value);
                    $.ajax({
                        url:'/index/power/getgroup',
                        data:{lv:data.value},
                        type:'post',
                        dataType:'json',
                        success:function(res){
                            $("#cid").html("");
                            $.each(res.msg, function(key, val) {
                                var option1 = $("<option>").val(val.id).text(val.title);
                                $("#cid").append(option1);
                                form.render('select');
                            });
                            // $("#cid").get(0).selectedIndex=0;
                        }
                    });
                });
                lay('.upload').each(function () {
                    upload.render({
                      elem: this
                      , url: '/index/index/uploadfield' //改成您自己的上传接口
                      , accept: 'file' //普通文件
                      , done: function (res) {
                        $("#field_"+this.item.attr('id')).val(res.msg);
                        layer.msg("上传成功");
                      }
                    });
                  });
                //监听提交
                form.on('submit(add)', function(data) {
                    console.log(data);
                    //发异步，把数据提交给php
                    $.ajax({
                        url:"",
                        data:data.field,
                        type:'post',
                        dataType:'json',
                        success:function (res) {
                            if (res.status==1){
                                layer.msg("更新成功",{icon:6,time:1500},function() {
                                    //关闭当前frame
                                    xadmin.close();
                                    // 可以对父窗口进行刷新
                                    xadmin.father_reload();
                                });
                            }else{
                                layer.alert(res.msg,function (index) {
                                    layer.close(index);
                                })
                            }
                        }
                    })

                    return false;
                });

            });

        </script>

    </body>

{/block}
